﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
@{
    Layout = null;
    ViewData["Title"] = "主页";
}
@*<script src="~/jquery-1.6.2.min.js"></script>*@
@*<input type="text" name="name" value="" id="name" />
    <input type="text" name="name" value="" id="pwd" />
    <input type="button" name="name" value="" onclick="Login()" />*@
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>登录</title>
    <link href="~/admui-13945148017-1592211513218/public/themes/global/css/bootstrap.css" rel="stylesheet" />
    <link href="~/admui-13945148017-1592211513218/public/fonts/web-icons/web-icons.css" rel="stylesheet" />
    <link href="~/admui-13945148017-1592211513218/public/themes/base/css/site.css" rel="stylesheet" />
    <link href="~/admui-13945148017-1592211513218/public/vendor/animsition/scss/animsition.css" rel="stylesheet" />
    <link href="~/admui-13945148017-1592211513218/public/css/login.css" rel="stylesheet" />
</head>
<body class="page-login layout-full page-dark" onkeydown="keyLogin()">
    <div class="page h-full">
        <div class="page-content h-full">
            <div class="page-brand-info vertical-align animation-slide-left d-none d-sm-block">
                <div class="page-brand vertical-align-middle">
                    <div class="brand">
                        <img class="brand-img" src="~/admui-13945148017-1592211513218/public/images/logo-white.svg" height="50" alt="Admui" />
                    </div>
                    <h2 class="title">房产CRM系统</h2>
                    <ul class="list-icons description">
                        <li>
                            <i class="wb-check" aria-hidden="true"></i>此关爱民生：热电企业是发电供热的企业，负有把党和政府对人民群众的关怀和温暖送到千家万户的重要职责，同时，为人民群众服务，也是热电企业赖以生存、发展的根本。
                        </li>
                        <li>
                            <i class="wb-check" aria-hidden="true"></i>服务创效：热电企业员工要树立爱国家、爱企业、爱岗位、爱用户，奉献为民的思想，在工作中讲敬业，在服务中创效益，在发展中求突破，为公司的转型升级贡献力量。
                        </li>
                        @*<li>
                                <i class="wb-check" aria-hidden="true"></i>Admui 紧贴业务特性，涵盖了大量的常用组件和基础功能，最大程度上帮助企业节省时间成本和费用开支。
                            </li>*@
                    </ul>
                </div>
            </div>
            <div class="page-login-main animation-fade">
                <div id="divError" class="alert alert-danger alert-dismissible" role="alert" runat="server" style="display:none">
                    <label id="tishi">用户名或密码错误！</label>
                </div>
                <div class="vertical-align">
                    <div class="vertical-align-middle">
                        <div class="brand text-center">
                            <img class="brand-img" src="~/admui-13945148017-1592211513218/public/images/logo-white.svg" height="50" alt="Admui" />
                        </div>
                        <h3 class="title">登录</h3>
                        <p class="description">房产CRM系统</p>
                        <form class="login-form" runat="server" id="loginForm">
                            <div class="form-group">
                                @*<label class="sr-only" for="username">账号</label>*@
                                <input type="text" name="loginName" class="form-control" value="" autocomplete="off" id="loginName" placeholder="请输入账号" />
                            </div>
                            <div class="form-group">
                                @*<label> class="sr-only" for="password">密码</label>*@
                                <input type="password"  name="password" class="form-control" value="" autocomplete="off" id="password" placeholder="请输入密码" />
                            </div>
                            <div class="form-group clearfix">
                                <div class="checkbox-custom checkbox-inline checkbox-primary float-left">
                                    <input type="checkbox" id="CheckBox1" name="vehicle" value="Car" checked="checked" />
                                    <label for="CheckBox1" id="single">保存密码</label>
                                </div>
                                <a class="float-right collapsed" data-toggle="collapse" href="#forgetPassword"
                                   aria-expanded="false" aria-controls="forgetPassword">
                                    忘记密码了？
                                </a>
                            </div>
                            <div class="collapse" id="forgetPassword" aria-expanded="true">
                                <div class="alert alert-warning alert-dismissible" role="alert">
                                    请联系管理员重置密码。
                                </div>
                            </div>
                            <button type="button" class="btn btn-primary btn-block" id="bt_ChongZhi" style="width: 100%;" onclick="Login()">立即登录</button>
                        </form>
                    </div>
                </div>
                <footer class="page-copyright">
                    <p>
                        &copy;
                        <a href="http://www.admui.com" target="_blank">admui.com</a>
                    </p>
                </footer>
            </div>
        </div>
    </div>

    <!-- 插件 -->
    <script src="~/admui-13945148017-1592211513218/public/vendor/jquery/jquery.min.js"></script>
    <script src="~/admui-13945148017-1592211513218/public/vendor/bootstrap/bootstrap.bundle.min.js"></script>
    <script src="~/admui-13945148017-1592211513218/public/vendor/jquery-validation/jquery.validate.min.js"></script>
    <script src="~/admui-13945148017-1592211513218/public/vendor/jquery-validation/localization/messages_zh.js"></script>
    <!-- Page JS -->
</body>
</html>



<script type="text/javascript">




    $(document).ready(function () {
        bangding();
        //退出登录
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        }
        var panduan = GetQueryString("tuichu");;
        if (panduan == "tuichu") {
            $.ajax({
                url: "../Login/panduan",
                data: {},
                type: "post",
                dataType: "text",
                success: function (response) {
                    $("#loginName").val('')
                    $("#password").val('')
                    $("#CheckBox1").attr('checked', 'checked');
                    $("#CheckBox1").removeAttr("checked");
                }
            });
        }
    })
    $('#loginName').focus();
    function keyLogin() {
        if (event.keyCode == 13) {
            document.getElementById("bt_ChongZhi").click();
        }
    }

    //保存密码
    function bangding() {
        $.ajax({
            url: "../Login/bangding",
            data: {},
            type: "post",
            dataType: "json",
            success: function (response) {
                $(response).each(function (key) {
                    if (key == 0) {
                        $("#loginName").val(response[key])
                        if (response[0] == "") {
                            $("#CheckBox1").removeAttr("checked");
                        } else {
                            $("#CheckBox1").attr('checked', 'checked');
                        }

                    } else if (key == 1) {
                        $("#password").val(response[key])
                    }
                })
            }
        });
    }
    //登录
    function Login() {
        if ($("#loginName").val == "") {
            alert("账户不能为空！")
        } else if ($("#password").val == "") {
            alert("密码不能为空！")
        } else {
            var zhuangtai;
            var $cr = $("#CheckBox1");         //获取JQuery对象
            var cr = $cr[0];            //DOM对象 或者 $cr.get(0)
            if (cr.checked) {
                zhuangtai = "选中"
            } else {
                zhuangtai = "未选中"
            }
            $.ajax({
                url: "../Login/DengLuCX",
                data: { "name": $("#loginName").val(), "pwd": $("#password").val(), zhuangtai: zhuangtai },
                type: "post",
                dataType: "text",
                success: function (response) {
                    if (response == "成功") {
                        location.href = '../Home/FenXiBaoBiao';

                    } else if (response == "密码错误") {
                        $('#password').focus();
                        $("#password").val('')
                        $("#tishi").text('密码错误！')
                        setTimeout(function () {
                            $("#divError").removeAttr('style');
                        });
                        setTimeout(function () {
                            $("#divError").attr('style', 'display:none')
                        }, 2500);

                    } else if (response == "账号错误") {
                        $('#loginName').focus();
                        $("#loginName").val('')
                        $("#password").val('')
                        $("#tishi").text('账号错误！')
                        setTimeout(function () {
                            $("#divError").removeAttr('style');
                        });
                        setTimeout(function () {
                            $("#divError").attr('style', 'display:none')
                        }, 2500);
                    }
                }
            });
        }
    }
</script>

